package com.books.mapper.address;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.books.model.entity.address.Receiving_address;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AddressMapper extends BaseMapper<Receiving_address> {
    @Select ("select * from receiving_address where people_id=#{people_id}")
    List<Receiving_address> findAll(int people_id);

    @Select ("select count(*) from receiving_address where people_id=#{people_id}")
    int findById(int people_id);

    @Delete ("delete from receiving_address where id=#{id}")
    void delById(int id);

    @Insert ("insert into receiving_address values(null,#{name},#{phone},#{address},#{zipCode},#{peopleId})")
    void addAddress(Receiving_address receiving_address);

}
